﻿namespace Vin.Tool.Core.PathCategory;

public class PathTool
{
    public static string DirPathCheck(string dir, bool startWithSlash = true)
    {
        dir = startWithSlash switch
        {
            true => dir.StartsWith("/") ? dir : $"/{dir}",
            false => dir.StartsWith("/") ? dir[1..] : dir
        };
        return dir.EndsWith("/") ? dir : dir + "/";
    }

    public static string ExtensionCheck(string extension)
    {
        return extension.StartsWith(".") ? extension : $".{extension}";
    }
}